#include <iostream>

/*
    运算符以及其重载
*/

class Entity
{

public:
    int x, y;
    Entity(int xa, int ya) : x(xa), y(ya) {}

public:
    //重载 + 运算符
    Entity operator+(const Entity &other)
    {
        return Entity(x+other.x,y+other.y);
    }
};

// 重载<<运算符
std::ostream& operator<<(std::ostream& stream,const Entity& e)
{
    stream << e.x << "," << e.y;
    return stream;
}

int main()
{
    Entity position(1,1);
    Entity move(4,5);
    Entity now = position + move;

    std::cout << "now:\t" <<now << std::endl;
}
